
package com.seekting.study;

import java.io.File;
import java.io.RandomAccessFile;

public class RandomAessFileStudy {

    public static void main(String[] args) throws Exception {
        File file = new File("randomAccessFile");
        if (!file.exists()) {
            file.createNewFile();
        }
        RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
        // randomAccessFile.write(3);
        randomAccessFile.seek(0);

        int j = randomAccessFile.read();
        int k = randomAccessFile.read();
        k = randomAccessFile.read();
        k = randomAccessFile.read();
        k = randomAccessFile.read();
        int size = (int) randomAccessFile.length();
        System.out.println(j + "" + k + " " + size);

        randomAccessFile.close();

        int i = -1;
        byte b = 127;
        System.out.println(Integer.toHexString(b));

    }
}
